m=int(input())
if 999 < m < 10000:
   k=0
   for i in range(2,m//2):
      if m % i == 0:
         k+=1
   if k==0:
      print(m)
   else:
        m1=m%1000
        m2=m//10
        for i in range(2,m//2):
else:
    print()






























